package tx.bjdacp.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bjdacp.model.*;
import tx.bjdacp.dao.*;
import tx.bjdacp.service.*;
import tx.bjdacp.vo.query.*;


@Entity
@Table(name = "bjdacp_basic_drug")
public class BasicDrug extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "基本药物目录";
	public static final String ALIAS_BASIC_DRUG_ID = "basicDrugId";
	public static final String ALIAS_DRUG_SELL_UNIT_ID = "drugSellUnitId";
	public static final String ALIAS_VARIETY_NAME = "品种名称";
	public static final String ALIAS_DOSAGE_FORM = "剂型";
	public static final String ALIAS_SPEC = "规格";
	public static final String ALIAS_PRODUCING_AREA = "产地";
	public static final String ALIAS_SELL_UNIT = "供货单位";
	public static final String ALIAS_REMARK = "备注";
	public static final String ALIAS_DRUG_KIND = "药物种类";

	//date formats


	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * basicDrugId       db_column: basic_drug_id
     */
	
	private java.lang.Integer basicDrugId;
    /**
     * drugSellUnitId       db_column: drug_sell_unit_id
     */
	
	private java.lang.Integer drugSellUnitId;
    /**
     * 品种名称       db_column: variety_name
     */
	@Length(max=100)
	private java.lang.String varietyName;
    /**
     * 剂型       db_column: dosage_form
     */
	@Length(max=100)
	private java.lang.String dosageForm;
    /**
     * 规格       db_column: spec
     */
	@Length(max=100)
	private java.lang.String spec;
    /**
     * 产地       db_column: producing_area
     */
	@Length(max=100)
	private java.lang.String producingArea;
    /**
     * 供货单位       db_column: sell_unit
     */
	@Length(max=100)
	private java.lang.String sellUnit;
    /**
     * 备注       db_column: remark
     */
	@Length(max=1000)
	private java.lang.String remark;
    /**
     * 药物种类       db_column: drug_kind
     */
	@Length(max=100)
	private java.lang.String drugKind;
	//columns END


	public BasicDrug(){
	}

	public BasicDrug(
		java.lang.Integer basicDrugId
	){
		this.basicDrugId = basicDrugId;
	}



	public void setBasicDrugId(java.lang.Integer value) {
		this.basicDrugId = value;
	}

	@Id	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "basic_drug_id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getBasicDrugId() {
		return this.basicDrugId;
	}

	@Column(name = "drug_sell_unit_id", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getDrugSellUnitId() {
		return this.drugSellUnitId;
	}

	public void setDrugSellUnitId(java.lang.Integer value) {
		this.drugSellUnitId = value;
	}

	@Column(name = "variety_name", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getVarietyName() {
		return this.varietyName;
	}

	public void setVarietyName(java.lang.String value) {
		this.varietyName = value;
	}

	@Column(name = "dosage_form", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getDosageForm() {
		return this.dosageForm;
	}

	public void setDosageForm(java.lang.String value) {
		this.dosageForm = value;
	}

	@Column(name = "spec", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getSpec() {
		return this.spec;
	}

	public void setSpec(java.lang.String value) {
		this.spec = value;
	}

	@Column(name = "producing_area", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getProducingArea() {
		return this.producingArea;
	}

	public void setProducingArea(java.lang.String value) {
		this.producingArea = value;
	}

	@Column(name = "sell_unit", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getSellUnit() {
		return this.sellUnit;
	}

	public void setSellUnit(java.lang.String value) {
		this.sellUnit = value;
	}

	@Column(name = "remark", unique = false, nullable = true, insertable = true, updatable = true, length = 1000)
	public java.lang.String getRemark() {
		return this.remark;
	}

	public void setRemark(java.lang.String value) {
		this.remark = value;
	}

	@Column(name = "drug_kind", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getDrugKind() {
		return this.drugKind;
	}

	public void setDrugKind(java.lang.String value) {
		this.drugKind = value;
	}


	private DrugSellUnit drugSellUnit;
	public void setDrugSellUnit(DrugSellUnit drugSellUnit){
		this.drugSellUnit = drugSellUnit;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "drug_sell_unit_id",nullable = false, insertable = false, updatable = false) 
	})
	public DrugSellUnit getDrugSellUnit() {
		return drugSellUnit;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("BasicDrugId",getBasicDrugId())
			.append("DrugSellUnitId",getDrugSellUnitId())
			.append("VarietyName",getVarietyName())
			.append("DosageForm",getDosageForm())
			.append("Spec",getSpec())
			.append("ProducingArea",getProducingArea())
			.append("SellUnit",getSellUnit())
			.append("Remark",getRemark())
			.append("DrugKind",getDrugKind())
			.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getBasicDrugId())
			.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof BasicDrug == false) return false;
		if(this == obj) return true;
		BasicDrug other = (BasicDrug)obj;
		return new EqualsBuilder()
			.append(getBasicDrugId(),other.getBasicDrugId())
			.isEquals();
	}
}

